<template>
	<view class="container">
		<!-- 优惠券 -->
		<u-navbar leftIcon="arrow-left" @leftClick="back" title="优惠券" bg-color="#00000000" titleStyle="color:#fff"
			leftIconColor="#fff" placeholder></u-navbar>

		<view class="content">
			<!-- 背景 -->
			<view class="top-bg"></view>

			<view class="main">
				<!-- tab头部 -->
				<u-tabs :list="list1" @click="click" :scrollable="false" activeStyle="font-size: 30rpx;color:#fff"
					inactiveStyle="font-size: 30rpx;color:#fff">
				</u-tabs>

				<!-- tab内容 -->
				<view class="tab-content">
					<!-- 待使用 -->
					<block v-if="tabOne">
						<view class="list">
							<image src="../../static/images/coupon-noUsed.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list">
							<image src="../../static/images/coupon-noUsed.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list">
							<image src="../../static/images/coupon-noUsed.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
					</block>

					<!-- 已使用 -->
					<block v-if="tabTwo">
						<view class="list">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
					</block>

					<!-- 已过期 -->
					<block v-if="tabThree">
						<view class="list tab-three">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination-del">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list tab-three">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination-del">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
						<view class="list tab-three">
							<image src="../../static/images/coupon-used.png" mode=""></image>
							<view class="text">
								<view class="top">
									<view class="left">
										<view class="limit">仅限于xx加油站使用</view>
										<view class="require">满200元可用</view>
									</view>
									<view class="denomination-del">￥<text class="rmb">20</text></view>
								</view>
								<view class="line"></view>
								<view class="bottom">
									<text class="term">有效期至：2020.04.11—2023.05.11</text>
									<text class="go">去使用 ></text>
								</view>
							</view>
						</view>
					</block>
				</view>
				<!-- <view class="placeholder"></view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabOne: true,
				tabTwo: false,
				tabThree: false,
				list1: [{
					name: '待使用',
				}, {
					name: '已使用',
				}, {
					name: '已过期'
				}, ],
			};
		},
		methods: {
			// 返回我的页面
			back() {
				uni.switchTab({
					url:'./My'
				});
			},
			// tab切换
			click(item) {
				// console.log('item', item);
				if (item.index == 0) {
					this.tabOne = true;
					this.tabTwo = false;
					this.tabThree = false;
				} else if (item.index == 1) {
					this.tabOne = false;
					this.tabTwo = true;
					this.tabThree = false;
				} else {
					this.tabOne = false;
					this.tabTwo = false;
					this.tabThree = true;
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		position: absolute;
		top: 0;

		.top-bg {
			width: 750rpx;
			height: 400rpx;
			// background-image: url('http://www.img.ttblog.cn/car/header-bg.png');
			background-color: #3384FC;
			background-size: cover;
			// display: flex;
			// flex-direction: column;
			// align-items: center;
		}

		.main {
			transform: translateY(-170rpx);
			margin-top: -100rpx;
			padding: 0 20rpx;
			box-sizing: border-box;

			.tab-content {
				background-color: #fff;
				border-radius: 20rpx;
				padding: 35rpx 30rpx;
				padding-bottom: 5rpx;
				box-sizing: border-box;
				position: relative;
				margin-top: 20rpx;

				.list {
					color: #fff;

					image {
						position: absolute;
						width: 92%;
						height: 250rpx;
					}

					.text {
						position: relative;
						z-index: 1;
						height: 250rpx;
						padding: 35rpx;
						box-sizing: border-box;
						margin-bottom: 25rpx;


						.top {
							display: flex;
							flex-direction: row;
							justify-content: space-between;
							align-items: center;
							margin-bottom: 30rpx;

							.left {

								.limit {
									font-size: 24rpx;
								}

								.require {
									font-size: 35rpx;
									font-weight: bold;
									margin-top: 10rpx;

								}
							}

							.denomination {
								font-size: 32rpx;
								font-weight: 100;

								.rmb {
									font-size: 80rpx;
									font-weight: bold;
								}
							}

							.denomination-del {
								font-size: 32rpx;
								font-weight: 100;
								text-decoration: none;

								.rmb {
									font-size: 80rpx;
									font-weight: bold;
									text-decoration: line-through;
								}
							}
						}

						.line {
							position: relative;
							left: -20rpx;
							width: 120%;
							border-top: 1rpx dashed #fff;
							margin-bottom: 20rpx;
						}

						.bottom {
							display: flex;
							flex-direction: row;
							justify-content: space-between;
							font-size: 24rpx;
						}
					}
				}

				.tab-three {
					image {
						filter: grayscale(100%);
					}
				}
			}


			.placeholder {
				height: 15.33vw;
			}

			/deep/ .u-button {
				width: 80%;
				background-color: #D9D9D9;
				color: #fff;
			}
		}
	}
</style>